<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>怎么获取kindeditor中的内容 - 倾城の陌</title>
    
    <!-- jQuery(Bootstrap的JavaScript插件需要引入jQuery，务必在bootstrap.min.js之前引入) -->
	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" data-integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" data-crossorigin="anonymous">
	
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" data-integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" data-crossorigin="anonymous"></script>
	
	<link rel="stylesheet" type="text/css" href="../../live2d/waifu.css"/>
	
	<link rel="stylesheet" type="text/css" href="../../static/nav.css"/>
	<script charset="utf-8" src="../../static/nav.js"></script>
</head>

<body id=>
<!-- 导航栏 -->
<nav class="nav_load"></nav>

<div class="waifu">
	<div class="waifu-tips"></div>
	<canvas id="live2d" width="280" height="600" class="live2d"></canvas>
	<div class="waifu-tool">
		<span class="fui-home"></span>
		<span class="fui-chat"></span>
		<span class="fui-eye"></span>
		<span class="fui-user"></span>
		<span class="fui-photo"></span>
		<span class="fui-info-circle"></span>
		<span class="fui-cross"></span>
	</div>
    <script src="../../live2d/live2d.js"></script>
	<script src="../../live2d/waifu-tips.js"></script>
</div>

<!-- 内容 -->
<div class="container-fluid">
	<div class="row">
		<div id="content" class="col-xs-12 col-sm-8 col-sm-offset-2">
<h1>
	怎么获取<span>kindeditor中的内容：</span>
</h1>
<blockquote>
	<p style="text-align:left;">
		解决办法就是在初始化kindeditor时加入一行代码：
	</p>
</blockquote>
<blockquote>
	<blockquote>
		<p style="text-align:left;">
			afterBlur: function(){this.sync();}
		</p>
		<p style="text-align:left;">
			<br />
		</p>
	</blockquote>
</blockquote>
<blockquote>
	<p style="text-align:left;">
		这行代码的意思就是在textarea失去焦点之后执行this.sync();
	</p>
	<p style="text-align:left;">
		<br />
	</p>
	<p style="text-align:left;">
		这个函数就是同步KindEditor的值到textarea文本框。
	</p>
	<p style="text-align:left;">
		<br />
	</p>
	<div style="text-align:left;">
		官方解释：
	</div>
</blockquote>
<blockquote>
	<blockquote>
		<p style="text-align:left;">
			sync()：将编辑器的内容设置到原来的textarea控件里。
		</p>
		<p style="text-align:left;">
			<br />
		</p>
	</blockquote>
</blockquote>
<blockquote>
	<div style="text-align:left;">
		<strong>具体初始化kindeditor时使用如下：</strong> 
	</div>
</blockquote>
<blockquote>
	<blockquote>
		<div style="text-align:left;">
			KindEditor.ready(function(K){
		</div>
	</blockquote>
</blockquote>
<blockquote>
	<blockquote>
		<blockquote>
			<div style="text-align:left;">
				K.create('textarea[name="content"]', {
			</div>
		</blockquote>
	</blockquote>
</blockquote>
<blockquote>
	<blockquote>
		<blockquote>
			<blockquote>
				<div style="text-align:left;">
					//下面这行代码就是关键的所在，当失去焦点时执行 this.sync();
				</div>
			</blockquote>
		</blockquote>
	</blockquote>
	<blockquote>
		<blockquote>
			<blockquote>
				<div style="text-align:left;">
					afterBlur: function(){this.sync();}
				</div>
			</blockquote>
		</blockquote>
	</blockquote>
</blockquote>
<blockquote>
	<blockquote>
		<blockquote>
			<div style="text-align:left;">
				});
			</div>
		</blockquote>
	</blockquote>
</blockquote>
<blockquote>
	<blockquote>
		<div style="text-align:left;">
			});
		</div>
	</blockquote>
</blockquote>
<blockquote>
	<div style="text-align:left;">
		<br />
	</div>
	<p style="text-align:left;">
		<strong>js：</strong><strong></strong> 
	</p>
	<div style="text-align:left;">
		var value = $("#editor").val();
	</div>
	<div style="text-align:left;">
		console.log(value);
	</div>
</blockquote>			
		</div>
 	</div>
</div>
</body>

<style>
	body {
		background-image: url("../../images/dnf_02.jpeg");
		background-repeat: no-repeat; 
		background-size: cover;
		-webkit-background-size: cover;
		-o-background-size: cover;
		-moz-background-size: cover;
		-ms-background-size: cover;
	}
	#content {
		background-color: rgba(255, 255, 255, 0.7);
		height: 100vh;
		overflow-x: scroll;
		overflow-y: scroll;
		color: #00868B;
	}
</style>
<script>
	
</script>
</html>